
poshidprobs_guess_user = 1./(1 + exp(-train_rate_matrix_user*vishid_user - repmat(hidbiases_user,num_users,1)));    
%poshidstates_guess_user = poshidprobs_guess_user > rand(num_users,numhid);
negdata_user = 1./(1 + exp(-poshidprobs_guess_user*vishid_user' - repmat(visbiases_user,num_users,1)));
%negdata_user = negdata_user.*test_template;

%mae_user = sum(sum(abs(negdata_user-test_real_matrix)))*5/test_size;

poshidprobs_guess_item = 1./(1 + exp(-train_rate_matrix_user'*vishid_item - repmat(hidbiases_item,num_items,1)));    
%poshidstates_guess_item = poshidprobs_guess_item > rand(num_items,numhid);
negdata_item = 1./(1 + exp(-poshidprobs_guess_item*vishid_item' - repmat(visbiases_item,num_items,1)));
%negdata_item = negdata_item.*test_template';

%mae_item = sum(sum(abs(negdata_item'-test_real_matrix)))*5/test_size;

negdata = (negdata_user + negdata_item')/2.*test_template;
mae = sum(sum(abs(negdata-test_real_matrix)))*5/test_size;
mae_round = sum(sum(abs(round(negdata*5)-test_real_matrix*5)))/test_size;

%fprintf(1, 'epoch %4i\tMAE %6f\tMAE_user %6f\tMAE_item %6f\t\t%6f\t%6f\t%6f\n', epoch, mae, mae_user, mae_item, mae_user-mae, mae_item-mae, mae_item-mae_user);
fprintf(1, 'epoch %4i\tMAE %6f\tMAE_round %6f\n', epoch, mae, mae_round);
%{
eee = epoch/5;
mae_plot(eee,1)=mae;
mae_plot(eee,2)=mae_user;
mae_plot(eee,3)=mae_item;
mae_plot(eee,4)=mae_user-mae;
mae_plot(eee,5)=mae_item-mae;
mae_plot(eee,6)=mae_item-mae_user;
%}
%{
plot(mae_plot(1:eee,1))
hold on
plot(mae_plot(1:eee,2))
plot(mae_plot(1:eee,3))
plot(mae_plot(1:eee,4))
plot(mae_plot(1:eee,5))
plot(mae_plot(1:eee,6))
%}